import React from 'react'
import {Icon, NavBar} from "antd-mobile";
import {withRouter} from 'react-router-dom';

const Index = ({history, title = '', onLeftClick}) => {
    if (!onLeftClick) {
        onLeftClick = () => {
            history.goBack();
        }
    }

    return (
        <NavBar
            mode="dark"
            icon={<Icon type="left"/>}
            onLeftClick={onLeftClick}
            rightContent={[
                <Icon key="0" type="search" style={{marginRight: '16px'}}/>,
            ]}
            style={{backgroundColor: '#302F34'}}
        >{title}</NavBar>
    );
};

export default withRouter(Index)
